//
//  MainService.m
//  HousingPoliceAssistant
//
//  Created by 云警01 on 2019/6/6.
//  Copyright © 2019 盛洋. All rights reserved.
//

#import "MainService.h"

static MainService *_mainService = nil;

@implementation MainService

+ (MainService*)sharedService{
    
    @synchronized(self){
        if(!_mainService){
            _mainService = [[MainService alloc] init];
        }
    }
    return _mainService;
}
-(void)initMainService:(UIWindow*)window{
    
//    //判断是否第一次启动 来显示介绍页和启动页
//    if(![[DataService sharedService] isFirstStart]){
//
//        HelpView *help = [[HelpView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H)isload:YES];
//        [help setDeleagate:self];
//        [help creatFlashTitleView];
//        [window addSubview:help];
//    }else{
//
//        [self launchAd];
//    }
    //发送广告请求
    //[[GlobalVariables sharedInstance] getListAdNews];
    _IsKeyboardOpen = NO;
    //全局记录键盘打开状态
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
    
}

-(void)initMainService
{
    _IsKeyboardOpen = NO;
    //全局记录键盘打开状态
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
}

-(void)keyboardWillHide:(NSNotification *)notification
{
    //NSLog(@"*-----HideKeyBoard");
    _IsKeyboardOpen = NO;
}

-(void)keyboardWillShow:(NSNotification *)notification
{
    //NSLog(@"*-----ShowKeyBoard");
    _IsKeyboardOpen = YES;
}
//#pragma mark - 启动页广告
//
//-(void)launchAd{
//    LaunchVC *lvc = [[LaunchVC alloc] init];
//    [ssNav pushViewController:lvc animated:NO];
//    lvc.view.frame = CGRectMake(0, 0, SCREEN_W, SCREEN_H);
//    [lvc setDelegate:self];
//}
#pragma mark - PushViewController

-(void)pushViewController:(UIViewController*)vc{
    
//    [ssNav pushViewController:vc animated:YES];
    
}


+(void)showHud:(NSString*)Str isKeyBoardShow:(BOOL)isKeyBoardShow{
    cnhbMsgAlert *alert = [[cnhbMsgAlert alloc] init];
    alert.isKeyBoardShow = isKeyBoardShow;
    [alert setTextColor:[UIColor whiteColor]];
    [alert showMessage:Str];
}

@end
